using System;
using System.Collections.Generic;
using System.Text;
using System.Data;

namespace DTO
{
	/// <summary> 
	///Author: nnamthach@gmail.com 
	/// <summary>
	
    public class MLCInfo
    {
		#region Local Variable
		public enum Field
		{
			TVC_DB,
			LOOKUP,
			CREATEDBY,
			MODIFIEDBY,
			CREATEDDATE,
			MODIFIEDDATE,
			CODE,
			DESCRIPTION,
			HEADER,
			NONVALIDATED,
			CATEGORY
		}
		private String _TVC_DB;
		private String _LOOKUP;
		private String _CREATEDBY;
		private String _MODIFIEDBY;
		private Int32 _CREATEDDATE;
		private Int32 _MODIFIEDDATE;
		private String _CODE;
		private String _DESCRIPTION;
		private String _HEADER;
		private String _NONVALIDATED;
		private String _CATEGORY;
		
		public String TVC_DB{	get{ return _TVC_DB;} set{_TVC_DB = value;} }
		public String LOOKUP{	get{ return _LOOKUP;} set{_LOOKUP = value;} }
		public String CREATEDBY{	get{ return _CREATEDBY;} set{_CREATEDBY = value;} }
		public String MODIFIEDBY{	get{ return _MODIFIEDBY;} set{_MODIFIEDBY = value;} }
		public Int32 CREATEDDATE{	get{ return _CREATEDDATE;} set{_CREATEDDATE = value;} }
		public Int32 MODIFIEDDATE{	get{ return _MODIFIEDDATE;} set{_MODIFIEDDATE = value;} }
		public String CODE{	get{ return _CODE;} set{_CODE = value;} }
		public String DESCRIPTION{	get{ return _DESCRIPTION;} set{_DESCRIPTION = value;} }
		public String HEADER{	get{ return _HEADER;} set{_HEADER = value;} }
		public String NONVALIDATED{	get{ return _NONVALIDATED;} set{_NONVALIDATED = value;} }
		public String CATEGORY{	get{ return _CATEGORY;} set{_CATEGORY = value;} }
		
        #endregion LocalVariable
        
        #region Constructor
		public MLCInfo()
		{
			_TVC_DB = "";
			_LOOKUP = "";
			_CREATEDBY = "";
			_MODIFIEDBY = "";
			_CREATEDDATE = 0;
			_MODIFIEDDATE = 0;
			_CODE = "";
			_DESCRIPTION = "";
			_HEADER = "";
			_NONVALIDATED = "";
			_CATEGORY = "";
		}
		public MLCInfo(
		String TVC_DB,
		String LOOKUP,
		String CREATEDBY,
		String MODIFIEDBY,
		Int32 CREATEDDATE,
		Int32 MODIFIEDDATE,
		String CODE,
		String DESCRIPTION,
		String HEADER,
		String NONVALIDATED,
		String CATEGORY
		)
		{
			_TVC_DB = TVC_DB;
			_LOOKUP = LOOKUP;
			_CREATEDBY = CREATEDBY;
			_MODIFIEDBY = MODIFIEDBY;
			_CREATEDDATE = CREATEDDATE;
			_MODIFIEDDATE = MODIFIEDDATE;
			_CODE = CODE;
			_DESCRIPTION = DESCRIPTION;
			_HEADER = HEADER;
			_NONVALIDATED = NONVALIDATED;
			_CATEGORY = CATEGORY;
		}
		public MLCInfo(DataRow dr)
		{
			if (dr != null)
			{
				_TVC_DB = dr[Field.TVC_DB.ToString()] == DBNull.Value?"":Convert.ToString(dr[Field.TVC_DB.ToString()]);
				_LOOKUP = dr[Field.LOOKUP.ToString()] == DBNull.Value?"":Convert.ToString(dr[Field.LOOKUP.ToString()]);
				_CREATEDBY = dr[Field.CREATEDBY.ToString()] == DBNull.Value?"":Convert.ToString(dr[Field.CREATEDBY.ToString()]);
				_MODIFIEDBY = dr[Field.MODIFIEDBY.ToString()] == DBNull.Value?"":Convert.ToString(dr[Field.MODIFIEDBY.ToString()]);
				_CREATEDDATE = dr[Field.CREATEDDATE.ToString()] == DBNull.Value?0:Convert.ToInt32(dr[Field.CREATEDDATE.ToString()]);
				_MODIFIEDDATE = dr[Field.MODIFIEDDATE.ToString()] == DBNull.Value?0:Convert.ToInt32(dr[Field.MODIFIEDDATE.ToString()]);
				_CODE = dr[Field.CODE.ToString()] == DBNull.Value?"":Convert.ToString(dr[Field.CODE.ToString()]);
				_DESCRIPTION = dr[Field.DESCRIPTION.ToString()] == DBNull.Value?"":Convert.ToString(dr[Field.DESCRIPTION.ToString()]);
				_HEADER = dr[Field.HEADER.ToString()] == DBNull.Value?"":Convert.ToString(dr[Field.HEADER.ToString()]);
				_NONVALIDATED = dr[Field.NONVALIDATED.ToString()] == DBNull.Value?"":Convert.ToString(dr[Field.NONVALIDATED.ToString()]);
				_CATEGORY = dr[Field.CATEGORY.ToString()] == DBNull.Value?"":Convert.ToString(dr[Field.CATEGORY.ToString()]);
			}
		}
        public MLCInfo(DataRowView dr)
        {
            if (dr != null)
            {
                _TVC_DB = dr[Field.TVC_DB.ToString()] == DBNull.Value ? "" : Convert.ToString(dr[Field.TVC_DB.ToString()]);
                _LOOKUP = dr[Field.LOOKUP.ToString()] == DBNull.Value ? "" : Convert.ToString(dr[Field.LOOKUP.ToString()]);
                _CREATEDBY = dr[Field.CREATEDBY.ToString()] == DBNull.Value ? "" : Convert.ToString(dr[Field.CREATEDBY.ToString()]);
                _MODIFIEDBY = dr[Field.MODIFIEDBY.ToString()] == DBNull.Value ? "" : Convert.ToString(dr[Field.MODIFIEDBY.ToString()]);
                _CREATEDDATE = dr[Field.CREATEDDATE.ToString()] == DBNull.Value ? 0 : Convert.ToInt32(dr[Field.CREATEDDATE.ToString()]);
                _MODIFIEDDATE = dr[Field.MODIFIEDDATE.ToString()] == DBNull.Value ? 0 : Convert.ToInt32(dr[Field.MODIFIEDDATE.ToString()]);
                _CODE = dr[Field.CODE.ToString()] == DBNull.Value ? "" : Convert.ToString(dr[Field.CODE.ToString()]);
                _DESCRIPTION = dr[Field.DESCRIPTION.ToString()] == DBNull.Value ? "" : Convert.ToString(dr[Field.DESCRIPTION.ToString()]);
                _HEADER = dr[Field.HEADER.ToString()] == DBNull.Value ? "" : Convert.ToString(dr[Field.HEADER.ToString()]);
                _NONVALIDATED = dr[Field.NONVALIDATED.ToString()] == DBNull.Value ? "" : Convert.ToString(dr[Field.NONVALIDATED.ToString()]);
                _CATEGORY = dr[Field.CATEGORY.ToString()] == DBNull.Value ? "" : Convert.ToString(dr[Field.CATEGORY.ToString()]);
            }
        }
		public MLCInfo(MLCInfo objEntr)
		{			
			_TVC_DB = objEntr.TVC_DB;			
			_LOOKUP = objEntr.LOOKUP;			
			_CREATEDBY = objEntr.CREATEDBY;			
			_MODIFIEDBY = objEntr.MODIFIEDBY;			
			_CREATEDDATE = objEntr.CREATEDDATE;			
			_MODIFIEDDATE = objEntr.MODIFIEDDATE;			
			_CODE = objEntr.CODE;			
			_DESCRIPTION = objEntr.DESCRIPTION;			
			_HEADER = objEntr.HEADER;			
			_NONVALIDATED = objEntr.NONVALIDATED;			
			_CATEGORY = objEntr.CATEGORY;			
		}
        #endregion Constructor
        
        #region InitTable
		public static DataTable ToDataTable()
		{
			DataTable dt = new DataTable("MLC");
			dt.Columns.AddRange(new DataColumn[] { 
				new DataColumn(Field.TVC_DB.ToString(), typeof(String)),
				new DataColumn(Field.LOOKUP.ToString(), typeof(String)),
				new DataColumn(Field.CREATEDBY.ToString(), typeof(String)),
				new DataColumn(Field.MODIFIEDBY.ToString(), typeof(String)),
				new DataColumn(Field.CREATEDDATE.ToString(), typeof(Int32)),
				new DataColumn(Field.MODIFIEDDATE.ToString(), typeof(Int32)),
				new DataColumn(Field.CODE.ToString(), typeof(String)),
				new DataColumn(Field.DESCRIPTION.ToString(), typeof(String)),
				new DataColumn(Field.HEADER.ToString(), typeof(String)),
				new DataColumn(Field.NONVALIDATED.ToString(), typeof(String)),
				new DataColumn(Field.CATEGORY.ToString(), typeof(String))
			});
            dt.Columns[Field.CATEGORY.ToString()].ExtendedProperties.Add("lookup", "CAT");
			return dt;
		}
		public DataRow ToDataRow(DataTable dt)
		{
			DataRow row = dt.NewRow();
			row[Field.TVC_DB.ToString()] = _TVC_DB;
			row[Field.LOOKUP.ToString()] = _LOOKUP;
			row[Field.CREATEDBY.ToString()] = _CREATEDBY;
			row[Field.MODIFIEDBY.ToString()] = _MODIFIEDBY;
			row[Field.CREATEDDATE.ToString()] = _CREATEDDATE;
			row[Field.MODIFIEDDATE.ToString()] = _MODIFIEDDATE;
			row[Field.CODE.ToString()] = _CODE;
			row[Field.DESCRIPTION.ToString()] = _DESCRIPTION;
			row[Field.HEADER.ToString()] = _HEADER;
			row[Field.NONVALIDATED.ToString()] = _NONVALIDATED;
			row[Field.CATEGORY.ToString()] = _CATEGORY;
			return row;
		}
        #endregion InitTable
    }
}
